﻿using System.Collections.Generic;
using System.Data;
namespace SLS.ExClassLib.HLASimulation.Federation
{
    public class ProcessPoint:ResourceBase
    {
        private readonly object _locker = new object();
        public string ProcessPointKey;
        public string ProcessPointID;
        public string SM;
        public string AgentID;
        private  string m_INSTANCEID;
        private string m_InstanceKey;
        public ProcessPoint(DataRow rowProcessPoint)
            :base()
            {
            this.ProcessPointKey = rowProcessPoint["ProcessPointKey"].ToString().Trim();
            this.ProcessPointID = rowProcessPoint["ProcessPointID"].ToString().Trim();
            this.SM = rowProcessPoint["SM"].ToString().Trim();
            this.AgentID = rowProcessPoint["AgentID"].ToString().Trim();
            this.m_INSTANCEID = rowProcessPoint["INSTANCEID"].ToString().Trim();
            this.m_InstanceKey = rowProcessPoint["InstanceKey"].ToString().Trim();
            base.NewResource(ProcessPointKey);
        }
        public List<ProcessPoint> NewProcessPointByTable(string MAAgentID,DataTable tableProcessPoint) 
        {
            List<ProcessPoint> m_listProcessPoint = new List<ProcessPoint>();
            ProcessPoint m_ProcessPoint;
            string expression="AgentID='"+MAAgentID+"'";
            DataRow[] tbProcessPoint=tableProcessPoint.Select(expression);
            foreach (DataRow rowProcessPoint in tbProcessPoint)
            {
                m_ProcessPoint = new ProcessPoint(rowProcessPoint);
                m_listProcessPoint.Add(m_ProcessPoint);
            }
            return m_listProcessPoint;
        }
        public ProcessPoint(ProcessPoint srcProcessPoint)
            {
            this.ProcessPointKey = srcProcessPoint.ProcessPointKey;
            this.ProcessPointID = srcProcessPoint.ProcessPointID;
            this.SM = srcProcessPoint.SM;
            this.AgentID = srcProcessPoint.AgentID;
            this.m_INSTANCEID = srcProcessPoint.m_INSTANCEID;
            this.m_InstanceKey = srcProcessPoint.m_InstanceKey;
            base.NewResource(ProcessPointKey);
        }
        public ProcessPoint()
            :base()
        { }
    }
}
